/*
 * Copyright (c) 2025 CAX Conversion Project
 */
package com.comac.ins.isfd.constant.enums;

import com.comac.ins.common.core.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;


/**
 * 模型管理下载类型
 *
 * @author hxloongs
 * @date 2024-9-12
 */
@AllArgsConstructor
@Getter
public enum IsfdModelManagementDownLoadTypeEnum {

    PART("part", "零件"),
    TASK("task", "任务"),
    CALCULATE("calculate", "计算文件");

    private final String value;
    private final String desc;

    public static String getDescByValue(String value) {
        IsfdModelManagementDownLoadTypeEnum isfdModelManagementDownLoadTypeEnum = forValue(value);
        if (isfdModelManagementDownLoadTypeEnum == null) {
            return null;
        }
        return isfdModelManagementDownLoadTypeEnum.getDesc();
    }

    public static IsfdModelManagementDownLoadTypeEnum forValue(String value) {
        if (StringUtils.isBlank(value)) {
            return null;
        }
        for (IsfdModelManagementDownLoadTypeEnum isfdModelManagementDownLoadTypeEnum : IsfdModelManagementDownLoadTypeEnum.values()) {
            if (isfdModelManagementDownLoadTypeEnum.getValue().equals(value)) {
                return isfdModelManagementDownLoadTypeEnum;
            }
        }
        return null;
    }

    public static IsfdModelManagementDownLoadTypeEnum forDesc(String desc) {
        if (desc == null) {
            return null;
        }
        for (IsfdModelManagementDownLoadTypeEnum isfdModelManagementDownLoadTypeEnum : IsfdModelManagementDownLoadTypeEnum.values()) {
            if (desc.equals(isfdModelManagementDownLoadTypeEnum.getDesc())) {
                return isfdModelManagementDownLoadTypeEnum;
            }
        }
        return null;
    }
}
